package util;

public class Funciones {

	public static int factorial(int n) {
		if (n == 0)
			return 1;
		int factorial = 1;
		for (int x = n; x > 1; x--) {
			factorial *= x;
		}
		return factorial;
	}

	public static int coeficienteBinomial(int n, int m) {
		if (n < m || n < 0 || m <= 0)
			throw new IllegalArgumentException("Datos incorrectos...");
		return factorial(n) / factorial(m) / factorial(n - m);
	}
}
